export type NewsState = {
  list: News[]
}

export type News = {
  art_id: string
  title: string
  aut_id: string
  comm_count: number
  pubdate: string
  aut_name: string
  is_top: number
  cover: {
    type: number
    images: string[]
  }
}

const initState: NewsState = {
  list: [],
}

export type NewsAction = { type: 'news/saveList'; payload: News[] }

export default function newsReducer(state = initState, action: NewsAction) {
  switch (action.type) {
    case 'news/saveList':
      return { ...state, list: action.payload }
    default:
      return state
  }
}
